import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { injectHtml } from 'vite-plugin-html'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    injectHtml({
      injectData:{
         crmcontextsrc : "/WebResources/ClientGlobalContext.js.aspx"
      }
    })
  ],
  base:"./",
  server:{
    open: true
  },
  resolve:{
    alias:{
      "@": path.resolve(__dirname,"src"),
      "XrmServiceTool": path.resolve(__dirname,"src/xrmhelper/XrmServiceToolkit.js")
    }
  },
  build:{
    assetsInlineLimit: 7168,  //内联为 base64 data URL
    assetsDir: 'assets',
    minify: false,   //是否开启压缩
    rollupOptions:{
      output:{
        entryFileNames: `assets/[name].js`,
        chunkFileNames: `assets/[name].js`,
        assetFileNames: `assets/[name].[ext]`,
      }
    }
  }
})
